From: Brion Vibber Date: Wed, 10 Dec 2008 23:06:44 +0000 (+0000) Subject: Revert r44257 "Use boolean searching with '?' char" X-Git-Tag: 1.31.0-rc.0~44054 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=26486f91eec530c1dce4657c5d08179d4682acc6;p=lhc%2Fweb%2Fwiklou.git Revert r44257 "Use boolean searching with '?' char" Let's avoid making up our own syntax that nobody will know or think to try... Lucene, Google, Yahoo!, and Windows Live search all understand "red OR lion" but see nothing special in "?red ?lion". If we're going to add it, let's make the OR thing work. :) --- diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 6aa726c8c2..66e8d9bb8a 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -150,7 +150,7 @@ class SearchEngine { } public static function legalSearchChars() { - return "A-Za-z_'0-9\\x80-\\xFF\\-\\?"; + return "A-Za-z_'0-9\\x80-\\xFF\\-"; } /** diff --git a/includes/SearchMySQL.php b/includes/SearchMySQL.php index 6f2b3388a5..f9b71c8ecd 100644 --- a/includes/SearchMySQL.php +++ b/includes/SearchMySQL.php @@ -43,18 +43,12 @@ class SearchMySQL extends SearchEngine { # FIXME: This doesn't handle parenthetical expressions. $m = array(); - if( preg_match_all( '/([-+<>?~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/', - $filteredText, $m, PREG_SET_ORDER ) ) - { + if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/', + $filteredText, $m, PREG_SET_ORDER ) ) { foreach( $m as $terms ) { if( $searchon !== '' ) $searchon .= ' '; - if( $this->strictMatching ) { - // '' means AND while ? means OR to the user - if( $terms[1] == '' ) { - $terms[1] = '+'; - } else if( $terms[1] == '?' ) { - $terms[1] = ''; - } + if( $this->strictMatching && ($terms[1] == '') ) { + $terms[1] = '+'; } $searchon .= $terms[1] . $wgContLang->stripForSearch( $terms[2] ); if( !empty( $terms[3] ) ) {